AxisScale Example

The following examples sets the x and y axes to either a percent scale or a logarithmic for a two-dimensional line chart. To try the example, draw an MSChart and two CommandButton controls on a form. Paste the code into the Form object's code module and run the project.

Private Sub Command1_Click()
   ' Change both x and y axes to Percent scale for 2D
   ' Line chart.
   Dim axisID As VtChAxisId
   MSChart1.ChartType = VtChChartType2dLine
   For AxisId = VtChAxisIdX To VtChAxisIdY
      With MSChart1.Plot.Axis(AxisId).AxisScale
         .Type = VtChScaleTypePercent
         .PercentBasis = VtChPercentAxisBasisSumChart
      End With
   Next
End Sub

Private Sub Command2_Click()
   Dim axisID As VtChAxisId
   ' Change both x and y axes to Logarithmic scale for 2D
   ' Line chart.
   MSChart1.ChartType = VtChChartType2dLine
   For axisID = VtChAxisIdX To VtChAxisIdY
      With MSChart1.Plot.Axis(axisID).AxisScale
         .Type = VtChScaleTypeLogarithmic
         .LogBase = 12
      End With
   Next
End Sub